package cn.sccl.dirms.topo.discovery.task;

import cn.sccl.dirms.topo.discovery.model.DiscoverTask;

import java.util.ArrayList;
import java.util.List;

public class BaseTaskThread implements Runnable {


	private DiscoveryService service;
	private String name;
	private List<DiscoverTask> tasks;



	public String getName() {
		return name;
	}
	public void setService(DiscoveryService service) {
		this.service = service;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<DiscoverTask> getTasks() {
		if(this.tasks == null) {
			this.tasks = new ArrayList<DiscoverTask>();
		}
		return tasks;
	}

	@Override
    public void run() {
		for(DiscoverTask item : this.getTasks()) {
			try {
				this.service.callTask(item,null);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}


}
